import Layout from '../../layout/DefaultLayout'

const layout = function (meta = {}, name = null) {
  return {
    path: '/eims' + (name !== null ? '/' + name : ''),
    name: name,
    component: Layout,
    meta: {
      ...meta
    }
  }
}

export default [
  {
    ...layout({title: '销售管理', icon: 'el-icon-s-order'}, 'salesManage'),
    children: [
      {
        path: 'salesOrder', // 销售订单
        name: 'salesOrder',
        component: () => import('@/views/eims/sales/order'),
        meta: {
          title: '销售订单',
          icon: 'order'
        }
      },
      {
        path: 'salesContract', // 销售合同
        name: 'salesContract',
        component: () => import('@/views/eims/sales/contract'),
        meta: {
          title: '销售合同',
          icon: 'contract'
        }
      },
      {
        path: 'salesRefund', // 销售退货
        name: 'salesRefund',
        component: () => import('@/views/eims/returnorder/salesOrder'),
        meta: {
          title: '销售退货',
          icon: 'contract'
        }
      }
    ]
  },
  {
    ...layout(),
    children: [{
      path: 'product', // 产品管理
      name: 'productManage',
      component: () => import('@/views/eims/product'),
      meta: {
        title: '产品管理',
        icon: 'el-icon-s-goods'
      }
    }]
  },
  {
    ...layout({title: '财务管理', icon: 'el-icon-s-finance'}, 'financeManage'),
    children: [
      {
        path: 'receivable', // 回款
        name: 'receivable',
        component: () => import('@/views/eims/finance/receivable'),
        meta: {
          title: '回款',
          icon: 'el-icon-sold-out'
        }
      },
      {
        path: 'payable', // 付款
        name: 'payable',
        component: () => import('@/views/eims/finance/payable'),
        meta: {
          title: '付款',
          icon: 'el-icon-sell'
        }
      }
    ]
  },
  {
    ...layout({title: '采购管理', icon: 'purchase'}, 'purchaseManage'),
    children: [
      {
        path: 'supplier', // 供应商
        name: 'supplier',
        component: () => import('@/views/eims/purchase/supplier'),
        meta: {
          title: '供应商',
          icon: 'supplier'
        }
      },
      {
        path: 'purchaseOrder', // 采购订单
        name: 'purchaseOrder',
        component: () => import('@/views/eims/purchase/order'),
        meta: {
          title: '采购订单',
          icon: 'order'
        }
      },
      {
        path: 'purchaseRefund', // 采购退货
        name: 'purchaseRefund',
        component: () => import('@/views/eims/returnorder/purchaseOrder'),
        meta: {
          title: '采购退货',
          icon: 'order'
        }
      }
    ]
  },
  {
    ...layout({title: '库存管理', icon: 'stock'}, 'stockManage'),
    children: [
      {
        path: 'warehouse', // 仓库管理
        name: 'warehouse',
        component: () => import('@/views/eims/stock/warehouse_manage'),
        meta: {
          title: '仓库管理',
          icon: 'warehouse'
        }
      },
      {
        path: 'inventory', // 产品库存
        name: 'inventory',
        component: () => import('@/views/eims/stock/product_storage'),
        meta: {
          title: '产品库存',
          icon: 'product_storage'
        }
      },
      {
        path: 'storage', // 产品入库
        name: 'storage',
        component: () => import('@/views/eims/stock/product_entry'),
        meta: {
          title: '产品入库',
          icon: 'product_entry'
        }
      },
      {
        path: 'delivery', // 产品出库
        name: 'delivery',
        component: () => import('@/views/eims/stock/product_out'),
        meta: {
          title: '产品出库',
          icon: 'product_out'
        }
      }
    ]
  }
]
